package com.dgut.courses_selecting_sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dgut.courses_selecting_sys.entity.Role;
import com.dgut.courses_selecting_sys.mapper.RoleMapper;
import com.dgut.courses_selecting_sys.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yuec
 * @since 2020-08-06
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    @Autowired
    RoleMapper roleMapper;

    @Override
    @Cacheable(value = "roles", key = "#id")
    public Role getDataByRoleId(int id) {
        return roleMapper.selectById(id);
    }
}
